package com.personal.enums;

/**
 * @author 萌新
 * @version 1.0
 * @date 2021/4/14 10:14
 */

/**
 * 使用枚举表示常量数据字典
 */
public enum ShopStateEnum {

    /**/
    CHECK(0, "审核中"), OFFLINE(-1, "非法店铺"), SUCCESS(1, "操作成功"), PASS(2, "审核通过"),
    INNER_ERROR(-1001, "操作失败"), NULL_SHOPID(-1002, "ShopId为空"),
    NULL_SHOP_INFO(-1003, "传入了空的信息");
    private int state;
    private String stateInfo;

    /**
     * 私有构造函数，禁止外部初始化改变定义的常量
     * @param state
     * @param stateInfo
     */
    private ShopStateEnum(int state, String stateInfo) {
        this.state = state;
        this.stateInfo = stateInfo;
    }

    public int getState() {
        return state;
    }

    public String getStateInfo() {
        return stateInfo;
    }


    public static ShopStateEnum stateOf(int state) {
        for (ShopStateEnum stateEnum : values()) {
            if(stateEnum.getState() == state){
                return stateEnum;
            }
        }
        return null;
    }

}
